package com.sscw.task.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.guaike.core.mybatis.plugins.BaseDAO;
import com.sscw.task.entity.MRankRichPO;
import com.sscw.task.mapper.MRankRichMapper;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public class MRankRichDAO extends BaseDAO<MRankRichMapper, MRankRichPO> {


    public List<MRankRichPO> findYesRankList(LocalDate yesterday, Integer size) {
        LambdaQueryWrapper<MRankRichPO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MRankRichPO::getRankDate, yesterday);
        queryWrapper.orderByDesc(MRankRichPO::getRechargeMoney);
        queryWrapper.last("limit 0," + size);
        return getBaseMapper().selectList(queryWrapper);
    }

}
